/*
Script: Client.js

Credits:
    Partially based on MooTools Framework - copyright (c) 2007 Valerio Proietti, <http://mad4milk.net>
    
Class: Client
	Some browser properties are attached to the Client object for browser detection.

Engine:
	UWA.Client.Engine.ie - is set to true if the current browser is internet explorer (any)
	UWA.Client.Engine.ie6 - is set to true if the current browser is internet explorer 6
	UWA.Client.Engine.ie7 - is set to true if the current browser is internet explorer 7
	UWA.Client.Engine.gecko - is set to true if the current browser is Mozilla/Gecko
	UWA.Client.Engine.webkit - is set to true if the current browser is Safari/Konqueror
	UWA.Client.Engine.webkit419 - is set to true if the current browser is Safari2 / webkit till version 419
	UWA.Client.Engine.webkit420 - is set to true if the current browser is Safari3 (Webkit SVN Build) / webkit over version 419
	UWA.Client.Engine.opera - is set to true if the current browser is opera
	UWA.Client.Engine.name - is set to the name of the engine

Platform:
	UWA.Client.Platform.mac - is set to true if the platform is mac
	UWA.Client.Platform.windows - is set to true if the platform is windows
	UWA.Client.Platform.linux - is set to true if the platform is linux
	UWA.Client.Platform.other - is set to true if the platform is neither mac, windows or linux
	UWA.Client.Platform.name - is set to the name of the platform

Note:
	Engine detection is entirely object-based.
*/

if (typeof UWA == "undefined") var UWA = {};

UWA.Client = {Engine: {'name': 'unknown', 'version': ''}, Platform: {}, 'features': {}};

//features
UWA.Client.features.xhr = !!(window.XMLHttpRequest);
UWA.Client.features.xpath = !!(document.evaluate);

//engine
if (window.opera) UWA.Client.Engine.name = 'opera';
else if (window.ActiveXObject) UWA.Client.Engine = {'name': 'ie', 'version': (UWA.Client.features.xhr) ? 7 : 6};
else if (!navigator.taintEnabled) UWA.Client.Engine = {'name': 'webkit', 'version': (UWA.Client.features.xpath) ? 420 : 419};
else if (document.getBoxObjectFor != null) UWA.Client.Engine.name = 'gecko';
UWA.Client.Engine[UWA.Client.Engine.name] = UWA.Client.Engine[UWA.Client.Engine.name + UWA.Client.Engine.version] = true;

//platform
var platform = navigator.platform.match(/(mac)|(win)|(linux)|(nix)/i) || ['Other'];
UWA.Client.Platform.name = platform[0].toLowerCase();
UWA.Client.Platform[UWA.Client.Platform.name] = true;

// Retro compatibility with old Browser object
if (typeof Browser == "undefined") var Browser = {};
if(UWA.Client.Engine.ie) Browser.isIE = true; else Browser.isIE = false;
if(UWA.Client.Engine.opera) Browser.isOpera = true; else Browser.isOpera = false;